class ApplicationController < ActionController::Base
  protect_from_forgery

  rescue_from(ActionController::InvalidAuthenticityToken) do |e|
    render :json => {:error => "InvalidAuthenticityToken"}.as_json
  end

  @@ERRORS = {
    # Currency Exchange Rates
    5101 => "input params incorrect",
    5102 => "probably currency code incorrect (passed codes: %s)",
  }

  def renderError code, *args
    render(:json => {:errorCode => code,
                     :errorDescription => sprintf(@@ERRORS[code], *args)}.as_json);
  end

end
